<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head>
        <title>Gerenciador de Avaliações</title>
    </h:head>
    <h:body>
        <h1>Gerenciador de Avaliação</h1>
        <h:form id="form">
            <p:growl id="msgs" showDetail="true" />
            <h:panelGrid columns="2" cellpadding="5">
                <h:inputHidden value="#{avaliacaoBean.avaliacao.id}" />
                <h:inputHidden value="#{avaliacaoBean.avaliacao.idColaborador}" />
                <p:outputLabel value="Nome" />
                <p:outputLabel value="#{avaliacaoBean.colaborador.nome}" />
                <p:outputLabel value="Data" />
                <p:calendar value="#{avaliacaoBean.avaliacao.referencia}" pattern="dd/MM/yyyy" locale="pt" effect="explode" />
                <p:outputLabel value="Status" /> 
                <p:inputText value="#{avaliacaoBean.avaliacao.status}" required="true" />
                <p:outputLabel value="Descrição" /> 
                <p:inputTextarea value="#{avaliacaoBean.avaliacao.descricao}" required="true" />
            </h:panelGrid>

            <p:panel id="basic" header="Criterios" style="margin:20px 0px; width: 300px">
                <!--<h:panelGrid columns="2" cellpadding="10">-->
                <ui:repeat value="#{avaliacaoBean.itemAvaliacao}"  var="item">
                    <h:inputHidden value="#{item.id}" />
                    <h:inputHidden value="#{item.idCriterio}" />
                    <h:panelGrid columns="2" cellpadding="5">
                        <p:outputLabel value="#{item.nomeCriterio} " />
                        <p:selectOneRadio value="#{item.valor}">
                            <f:selectItem itemLabel="Sim" itemValue="1" />
                            <f:selectItem itemLabel="Não" itemValue="0" />
                        </p:selectOneRadio>
                    </h:panelGrid>
                </ui:repeat>
                <!--</h:panelGrid>-->
            </p:panel>

            <p:commandButton action="#{avaliacaoBean.save}" value="Salvar" />
        </h:form>
    </h:body>
</html>
